import { _decorator, AudioSource, Component, instantiate, Node, UITransform } from 'cc';
import { AudioManager } from '../../GScript/core/modules/audio/AudioManager';
import { ResManager } from '../../GScript/core/modules/res/ResManager';
import { LoginAudio } from './LoginAudio';

const { ccclass, property } = _decorator;

@ccclass('LoginEntry')
export class LoginEntry extends Component {
    start() {

        AudioManager.getInstance().playMusic(LoginAudio.bgm)
        this.autoLogin();
    }

    autoLogin(){
        // 模拟登录实现（后续修改此实现即可）
        this.scheduleOnce(() => {
            this.onLoginSuccess();
        }, 1)
    }

    async onLoginSuccess(){

        await ResManager.getInstance().loadBundleAsync("Match3BN");
        let match3Entry = this.node.addComponent('Match3Entry');
        (match3Entry as any).init();

    }
    
}


